
// frist_order_items:"https://v2.api.haodanku.com/frist_order_items/apikey/{0}/back/50/min_id/{1}/cat_id/{2}/order/{3}"
import AppStore from "../store/appStore";
import axiosUtil from "../utils/axiosUtil";
import viewUtil from "../utils/viewUtil";
import {CreateHaoDanwangList} from "./modeCtr";

export function getfirts_order(min_id, cat_id, order) {
  return new Promise(resolve =>{
    var url = AppStore.data.taoBaoApi.frist_order_items.format(AppStore.data.taoBaoApi.haoDanKey,min_id,cat_id,order)
    // console.log(url)
    axiosUtil.get( url).then(res=>{
      // console.log(res)
      if (parseInt(res.code) !== 200){
        viewUtil.ShowToast('亲,数据到底了！～～');
        resolve(null)
      }else{
        let ttt = CreateHaoDanwangList(res.data);
        resolve({data: ttt, pageIndex: res.min_id});
      }
    })
  } )
}
